class QueryEntity {
    constructor({
                    position = '',
                    startTime = '',
                    endTime = '',
                    serverNumberAction = 1,
                    serverNameAction = 1,
                    ipAction = 1,
                    timeArray = [],
                } = {}) {
        this.position = position;
        this.startTime = startTime;
        this.endTime = endTime;
        this.serverNumberAction = serverNumberAction;
        this.serverNameAction = serverNameAction;
        this.ipAction = ipAction;
        this.timeArray = timeArray;
    }
}

new BasicTableVue({
    data: function () {
        return {
            api: baseServerInfoApi,
            columns: [
                TableColumn.generate({
                    type: 'selection',
                    width: 30,
                    align: 'center',
                }),
                TableColumn.generate({
                    prop: 'serverNumber',
                    title: '服务器编号',
                    align: 'center',
                }),
                TableColumn.generate({
                    prop: 'ip',
                    title: '服务器IP',
                    align: 'center',
                }),
                TableColumn.generate({
                    prop: 'useUserName',
                    title: '分配用户',
                    sortable: false,
                    align: 'center',
                }),
                TableColumn.generate({
                    prop: 'standard',
                    title: '服务器规格',
                    align: 'center',
                }),
                TableColumn.generate({
                    prop: 'model',
                    title: '服务器型号',
                    align: 'center',
                }),
                TableColumn.generate({
                    prop: 'os',
                    title: '操作系统',
                    align: 'center',
                }),
                TableColumn.generate({
                    prop: 'positionName',
                    title: '所在机位',
                    sortable: false,
                    align: 'center',
                }),
                TableColumn.generate({
                    prop: 'useDate',
                    title: '使用日期',
                    formatter: TableColumn.datetimeFormat,
                    align: 'center',
                }),
                TableColumn.generate({
                    prop: 'terminateDate',
                    title: '到期日期',
                    formatter: TableColumn.datetimeFormat,
                    align: 'center',
                }),
                TableColumn.generate({
                    prop: 'operating',
                    title: '操作',
                    customComponent: 'true',
                    sortable: false,
                    align: 'center',
                }),
            ],
            positions: [],
        }
    },
    methods: {
        createForm() {
            return new QueryEntity();
        },
        updateForward(data) {
            forward('/basic-data/modify/admin_servers_modify', data);
        },
        async init() {
            await this.initHousePositions();
        },
        initHousePositions: async function () {
            this.positions = await basePositionApi.selectList()
        },
        async downloadTemplate() {
            await baseServerInfoApi.downloadTemplate('服务器信息管理导入模板.xlsx');
        },
        timeArrayChange(array) {
            [start, end] = array || []
            this.form.startTime = start;
            this.form.endTime = end;
        },
    },
    watch: {
    },
})









